function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 2,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});


$(window).load(function() {
	mCustomScrollbars();
});

function mCustomScrollbars(){ 
	$("#mcs2_container").mCustomScrollbar("vertical",0,"easeOutCirc",1.05,"auto","yes","no",0);
}

/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
}

/* function to load new content dynamically */
function LoadNewContent(id,file){
	$("#"+id+" .customScrollBox .content").load(file,function(){
		mCustomScrollbars();
	});
}






 $(document).ready(function(){
	 
	 // popup anh lon
	 
	 $(".lightbox-2").lightbox({
		fitToScreen: true,
		scaleImages: true,
		xScale: 1.2,
		yScale: 1.2,
		displayDownloadLink: true
		});
	});
 
 
 
 
 
 $(function() {
				$('#foo0').carouFredSel();
				
				$('#foo1').carouFredSel({
					auto: {
						pauseOnHover: 'resume',
						onPauseStart: function( percentage, duration ) {
							$(this).trigger( 'configuration', ['width', function( value ) { 
								$('#timer1').stop().animate({
									width: value
								}, {
									duration: duration,
									easing: 'linear'
								});
							}]);
						},
						onPauseEnd: function( percentage, duration ) {
							$('#timer1').stop().width( 0 );
						},
						onPausePause: function( percentage, duration ) {
							$('#timer1').stop();
						}
					}
				});

				$('#foo2').carouFredSel({
					scroll: 2,
					prev: '#prev2',
					next: '#next2',
					pagination: "#pager2",
					auto: false
				});
				$('#foo3').carouFredSel({
					width: 360,
					height: "auto",
					next: '#next3',
					prev: '#prev3',
					auto: false
				});
				$('#foo4').carouFredSel({
					scroll: 1,
					next: '#next4',
					prev: '#prev4',
					auto: false
				});
			});